package cn.ctbu.simple_score_manage.dao;

import cn.ctbu.simple_score_manage.domain.Course;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface ICourseDao extends BaseMapper<Course> {
    /**
     * 通过学生的no查询学生未修的课程
     * @param studentNo
     * @return
     */
    @Select("<script>" +"select tb_teacher.`name` as teacherName,type,tb_course.`name` as courseName,tb_course.credit as credit , tb_course.`no` as courseNo from tb_course,tb_teacher  where tb_course.teacher_no = tb_teacher.`no` and\n" +
            "tb_course.`no` not in (SELECT course_no FROM tb_score where tb_score.student_no = #{studentNo})"+"</script>")
    List<Map<String, String>> selectNotChoseCourseByStudentNo(String studentNo);
}
